import React, { Fragment, Suspense, useEffect } from 'react'
import { useRoutes } from 'react-router-dom'
import routes from './routes'

import PageLoading from './component/pageLoading'

function App() {

  const element = useRoutes(routes);

  //[]空数组相当于componentDidMount
  useEffect(() => {

    //返回的函数相当于unmountComponentAtNode
    return () => {

    }
  }, []);

  return (
    <Fragment >
      <Suspense fallback={<PageLoading />}>
        {element}
      </Suspense>
    </Fragment>
  );
}

export default App;
